<h2>Edit Event - <?php echo $event->event_name ?></h2>
<h3><a href="<?php echo EM_URL ?>event-list.php">&laquo; Event List</a> </h3>
<form name="form1" method="post" action="">
<input type="hidden" name="event_id" value="<?php echo $event->id ?>"/>

<!-- If you're a TinyMCE expert, please tell me why these work here and not in the head!! -->
<?php if ( user_can_richedit() ) wp_print_scripts('wp_tiny_mce'); ?>

<fieldset id="titlediv">
  <legend><?php _e('Event Name:') ?></legend>
  <div><input type="text" name="event_name" size="30" tabindex="1" id="event_name" style="font-size: 1.5em;" value="<?php echo $event->event_name ?>" /></div>
</fieldset>

<fieldset id="<?php echo user_can_richedit() ? 'postdivrich' : 'postdiv'; ?>">
<legend><?php _e('Short Description:') ?></legend>

<?php the_editor($event->short_description, 'short_description', 'event_name'); ?>

</fieldset>

<h3>Event Listing and Registration</h3>
<table width="100%" cellspacing="2" cellpadding="5" class="editform">
<tr>
	<th scope="row" width="33%"><?php _e('Registration Start:') ?></th>
	<td><input type="text" name="registration_start" id="registration_start" size="10" maxlength="10" value="<?php echo mysql2date("m/d/Y", $event->registration_start) ?>" />
	<input type="button" id="registration_start_b" value="..." /></td>
</tr>
<tr>
	<th scope="row"><?php _e('Registration End:') ?></th>
	<td><input type="text" name="registration_end" id="registration_end" size="10" maxlength="10" value="<?php echo mysql2date("m/d/Y", $event->registration_end) ?>" />
	<input type="button" id="registration_end_b" value="..." /></td>
</tr>
<tr>
	<th scope="row"><?php _e('Listing Status:') ?></th>
	<td>
	<?php $sel = ' selected="selected"'; ?>
	<select name="listing_status">
		<option value="Unpublished"<?php echo $event->listing_status == "Unpublished" ? $sel : "" ?>>Unpublished</option>
		<option value="Published"<?php echo $event->listing_status == "Published" ? $sel : "" ?>>Published</option>
	</select>
	</td>
</tr>
<tr>
	<th scope="row"><?php _e('Event Start:') ?></th>
	<td><input type="text" name="event_start" id="event_start" size="10" maxlength="10" value="<?php echo mysql2date("m/d/Y", $event->event_start) ?>" />
		<input type="button" id="event_start_b" value="..." />
	  <input type="text" name="event_start_hour" size="2" maxlength="2" value="<?php echo mysql2date("h", $event->event_start) ?>" />:<input type="text" name="event_start_minute" size="2" maxlength="2" value="<?php echo mysql2date("i", $event->event_start) ?>" />
	  <select name="event_start_ap">
	  	<option value="AM"<?php echo mysql2date("A", $event->event_start) == "AM" ? $sel : "" ?>>AM</option>
	  	<option value="PM"<?php echo mysql2date("A", $event->event_start) == "PM" ? $sel : "" ?>>PM</option>
	  </select>
	</td>
</tr>
<!--
<tr>
	<th scope="row"><?php _e('Event End:') ?></th>
	<td><input type="text" name="event_end" id="event_end" size="10" maxlength="10" value="<?php echo mysql2date("m/d/Y", $event->event_end) ?>" />
	  <input type="text" name="event_end_hour" size="2" maxlength="2" value="<?php echo mysql2date("h", $event->event_end) ?>" />:<input type="text" name="event_end_minute" size="2" maxlength="2" value="<?php echo mysql2date("i", $event->event_end) ?>" />
	  <select name="event_end_ap">
	  	<option value="AM"<?php echo mysql2date("A", $event->event_end) == "AM" ? $sel : "" ?>>AM</option>
	  	<option value="PM"<?php echo mysql2date("A", $event->event_end) == "PM" ? $sel : "" ?>>PM</option>
	  </select>
	</td>
</tr>
-->
<tr>
	<th scope="row"><?php _e('Registration Limit:') ?></th>
	<td><input type="text" name="registration_limit" id="registration_limit" size="4" maxlength="4" value="<?php echo $event->registration_limit ?>"/></td>
</tr>
<tr>
	<th scope="row"><?php _e('Login Required:') ?></th>
	<td><input type="checkbox" name="login_required" id="login_required" value="Y" <?php checked('Y', $event->login_required); ?>/></td>
</tr>
</table>

<h3>Event Location</h3>
<table width="100%" cellspacing="2" cellpadding="5" class="editform">
<tr>
	<th scope="row" width="33%"><?php _e('Address:') ?></th>
	<td><input type="text" name="address1" size="30" maxlength="100" value="<?php echo $event->address1 ?>"/></td>
</tr>
<tr>
	<td></td>
	<td><input type="text" name="address2" size="30" maxlength="100" value="<?php echo $event->address2 ?>"/></td>
</tr>
<tr>
	<th scope="row"><?php _e('City:') ?></th>
	<td><input type="text" name="city" size="30" maxlength="64" value="<?php echo $event->city ?>"/></td>
</tr>
<tr>
	<th scope="row"><?php _e('State:') ?></th>
	<td><input type="text" name="state" size="2" maxlength="2" value="<?php echo $event->state ?>"/></td>
</tr>
<tr>
	<th scope="row"><?php _e('Zip:') ?></th>
	<td><input type="text" name="zip" size="10" maxlength="10" value="<?php echo $event->zip ?>"/></td>
</tr>
<tr>
	<th scope="row"></th>
	<td></td>
</tr>
</table>

<p class="submit">
<input type="submit" name="Submit" value="<?php _e('Update Event') ?> &raquo;" />
</p>
</form>

<script type="text/javascript">
  Calendar.setup(
    {
      inputField  : "registration_start",         // ID of the input field
      ifFormat    : "%m/%d/%Y",    // the date format
      button      : "registration_start_b"       // ID of the button
    }
  );
  Calendar.setup(
    {
      inputField  : "registration_end",         // ID of the input field
      ifFormat    : "%m/%d/%Y",    // the date format
      button      : "registration_end_b"       // ID of the button
    }
  );
  Calendar.setup(
    {
      inputField  : "event_start",         // ID of the input field
      ifFormat    : "%m/%d/%Y",    // the date format
      button      : "event_start_b"       // ID of the button
    }
  );
</script>